<div class="content-wrapper">

    <section class="content-header">
        <?php echo $this->partial('layout/breadcrumb'); ?>
        <h1 class="pull-right">
            <?php echo $this->HelpUrl('orderShipList'); ?>
        </h1>
    </section>

    <section class="content">
        <div class="row">
            <div class="col-xs-12">
                <div class="box shop-box">
                    <div class="box-body table-responsive no-padding">
                        <table class="table shop-table table-hover">
                            <thead>
                            <tr class="shop-bg-thead">
                                <th width="15%"><?php echo $this->translate('发货单号'); ?></th>
                                <th width="12%"><?php echo $this->translate('快递(物流)公司'); ?></th>
                                <th width="15%"><?php echo $this->translate('订单号'); ?></th>
                                <th width="15%"><?php echo $this->translate('下单时间'); ?></th>
                                <th width="10%"><?php echo $this->translate('收货人'); ?></th>
                                <th width="15%"><?php echo $this->translate('发货时间'); ?></th>
                                <th width="8%"><?php echo $this->translate('发货状态'); ?></th>
                                <th width="10%"><?php echo $this->translate('操作'); ?></th>
                            </tr>
                            <?php
                            $sForm = $this->searchForm;
                            $sForm->prepare();
                            $sForm->get('express_state')->setEmptyOption('选择状态');
                            ?>
                            <?php echo $this->form()->openTag($sForm); ?>
                            <tr>
                                <td>
                                    <?php echo $this->formElement($sForm->get('express_number')); ?>
                                    <?php echo $this->formElementErrors($sForm->get('express_number'), ['class'=>'error-message']);?>
                                </td>
                                <td>
                                    <?php echo $this->formElement($sForm->get('delivery_name')); ?>
                                    <p>
                                        <?php echo $this->formElement($sForm->get('one_ship')); ?> <small><?php echo $this->translate('单独配送'); ?></small>
                                    </p>
                                    <?php echo $this->formElementErrors($sForm->get('delivery_name'), ['class'=>'error-message']);?>
                                    <?php echo $this->formElementErrors($sForm->get('one_ship'), ['class'=>'error-message']);?>
                                </td>
                                <td>
                                    <?php echo $this->formElement($sForm->get('order_sn')); ?>
                                    <?php echo $this->formElementErrors($sForm->get('order_sn'), ['class'=>'error-message']);?>
                                </td>
                                <td>
                                    <p>
                                        <?php echo $this->formElement($sForm->get('start_time')); ?>
                                    </p>
                                    <div>
                                        <?php echo $this->formElement($sForm->get('end_time')); ?>
                                    </div>
                                    <?php echo $this->formElementErrors($sForm->get('start_time'), ['class'=>'error-message']);?>
                                    <?php echo $this->formElementErrors($sForm->get('end_time'), ['class'=>'error-message']);?>
                                </td>
                                <td>
                                    <?php echo $this->formElement($sForm->get('true_name')); ?>
                                    <?php echo $this->formElementErrors($sForm->get('true_name'), ['class'=>'error-message']);?>
                                </td>
                                <td>
                                    <p>
                                        <?php echo $this->formElement($sForm->get('express_start_time')); ?>
                                    </p>
                                    <div>
                                        <?php echo $this->formElement($sForm->get('express_end_time')); ?>
                                    </div>
                                    <?php echo $this->formElementErrors($sForm->get('express_start_time'), ['class'=>'error-message']);?>
                                    <?php echo $this->formElementErrors($sForm->get('express_end_time'), ['class'=>'error-message']);?>
                                </td>
                                <td>
                                    <?php echo $this->formElement($sForm->get('express_state')); ?>
                                    <?php echo $this->formElementErrors($sForm->get('express_state'), ['class'=>'error-message']);?>
                                </td>
                                <td>
                                    <button type="submit" class="btn btn-info btn-sm"><i class="fa fa-search"></i></button>
                                    <?php
                                    $formData = array_filter($sForm->getData());
                                    if(!empty($formData)) { ?>
                                        &nbsp;&nbsp;<a href="<?php echo $this->url('sales-ship');?>" class="btn btn-default btn-sm"><i class="fa fa-reply"></i></a>
                                    <?php } $formData['page'] = $this->shipList->getCurrentPageNumber(); ?>
                                </td>
                            </tr>
                            <?php echo $this->form()->closeTag(); ?>
                            </thead>
                            <tbody>
                            <?php if($this->shipList->getCurrentItemCount() > 0) foreach ($this->shipList as $shipValue) { ?>
                                <tr>
                                    <td><?php echo $shipValue['deliveryMode'] > 0 ? ($shipValue['deliveryMode'] ==1 ? $this->escapeHtml($shipValue['expressNumber']) : '<span class="text-blue">'.$this->translate('单独发货单号').'</span>') : '<span class="text-red">'.$this->translate('无').'</span>'; ?></td>
                                    <td><?php echo $shipValue['deliveryMode'] > 0 ? ($shipValue['deliveryMode'] ==1 ? $this->escapeHtml($shipValue['deliveryName']) : '<span class="text-blue">'.$this->translate('单独配送').'</span>') : '<span class="text-red">'.$this->translate('暂未指定').'</span>'; ?></td>
                                    <td><?php echo $this->escapeHtml($shipValue['orderSn']); ?></td>
                                    <td><?php echo $this->shopDateFormat()->orderTime($shipValue['orderAddTime']); ?></td>
                                    <td><?php echo $this->escapeHtml($shipValue[0]->getTrueName()); ?></td>
                                    <td><?php echo $shipValue['expressTime'] ? $this->shopDateFormat()->orderTime($shipValue['expressTime']) : '<span class="text-red">'.$this->translate('无').'</span>'; ?></td>
                                    <td><?php echo $shipValue['expressTime'] ? $this->translate('已发货') : $this->translate('未发货'); ?></td>
                                    <td>
                                        <a href="<?php echo $this->url('sales-ship',
                                            ['action'=>'detail', 'id'=>$shipValue[0]->getOrderId()], ['query' => $formData]); ?>"
                                           class="btn btn-xs btn-success"><i class="fa fa-info-circle"></i> <?php echo $this->translate('详情'); ?></a>
                                    </td>
                                </tr>
                            <?php } ?>
                            </tbody>
                        </table>
                    </div>
                    <div class="box-footer clearfix">
                        <?php echo $this->paginationControl($this->shipList, 'Sliding', 'layout/page', ['route' => 'sales-ship']); ?>
                    </div>
                </div>
            </div>
        </div>

    </section>
</div>
<script>
    laydate.render({elem: '#start_time'});
    laydate.render({elem: '#end_time'});

    laydate.render({elem: '#express_start_time'});
    laydate.render({elem: '#express_end_time'});
</script>